#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using i64=long long;
void solve()
{
    int n, k;
    cin >> n >> k;
    queue<int> q;
    for(int i = 1; i <= n; i++)
    {
        int m;
        cin >> m;
        q.push(m);
    }
    int ans = 0;
    while(q.size())
    {
        int gap = k;
        while(!q.empty() && q.front() <= gap)
        {
            gap -= q.front();
            q.pop();
        }
        ++ans;
    }
    cout << ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout<<fixed;
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}
